package com.nuonuo.nuo_xp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ((Button) findViewById(R.id.anniu1)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,get_ddms_tag(),Toast.LENGTH_SHORT).show();
            }
        });
        //md5算法
        ((Button)findViewById(R.id.anniu_md5)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    Toast.makeText(MainActivity.this,md5.get_md5(),Toast.LENGTH_SHORT).show();
                }catch (Exception e6) {
                    e6.printStackTrace();
                    return;
                }

            }
        });
        //SHA算法
        ((Button)findViewById(R.id.anniu_sha)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    Toast.makeText(MainActivity.this,SHA.get_sha_1(),Toast.LENGTH_SHORT).show();
                }catch (Exception e6) {
                    e6.printStackTrace();
                    return;
                }

            }
        });
        //hmac算法
        ((Button)findViewById(R.id.anniu_hmac)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this,HMAC.get_mac_1(),Toast.LENGTH_SHORT).show();
            }
        });



    }

    public String get_ddms_tag() {
        Log.d("XP","输出测试...");
        return "ddms输出Log Tag:XP"; }


    public void get_aes(View view) {
        try {
            Toast.makeText(MainActivity.this,AES.get_aes(),Toast.LENGTH_SHORT).show();
        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }

    public void get_des(View view) {
        try {
            Toast.makeText(MainActivity.this,DES.get_des_1(),Toast.LENGTH_SHORT).show();
        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }
    public void get_desede(View view) {
        try {
            Toast.makeText(MainActivity.this,DESede.get_desede(),Toast.LENGTH_SHORT).show();
        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }
    public void get_rsa(View view) {
        try {
            Toast.makeText(MainActivity.this,RSA.rsa(),Toast.LENGTH_SHORT).show();
        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }
    public void get_rsahex(View view) {
        try {
            Toast.makeText(MainActivity.this,RSAhex.rsaHex(),Toast.LENGTH_SHORT).show();

        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }
    public void get_https(View view) {
        try {
            Toast.makeText(MainActivity.this,HTTPS.HttpGet("http://www.baidu.com"),Toast.LENGTH_SHORT).show();

        }catch (Exception e6) {
            e6.printStackTrace();
            return;
        }
    }

}